﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _0517病例系统
{
    public partial class yaopin : Form
    {
        public yaopin()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            frmdrug drug = new frmdrug();
            drug.Activate();

            string strSql;
            _0517病例系统.DataAccess data = new _0517病例系统.DataAccess();
            strSql = "insert into Yaopinss(编号,名称,厂家,单价,库存,生产日期,过期日期) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + dateTimePicker1.Value.ToShortDateString() + "','" + dateTimePicker2.Value.ToShortDateString() + "')";
            data.dataCon();
            if (data.sqlExec(strSql))
            {
                MessageBox.Show("添加成功！");
                this.Hide();
                _0517.frmCer cer = new _0517.frmCer();
                cer.Activate();
            }
            else
            {
                MessageBox.Show("添加失败！");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            frmdrug drug = new frmdrug();
            drug.Activate();
        }
    }
}
